home *** CD-ROM | disk | FTP | other *** search
- Path: uunet!ns-mx!iowasp.physics.uiowa.edu!maverick.ksu.ksu.edu!zaphod.mps.ohio-state.edu!usc!cs.utexas.edu!sun-barr!newstop!sun!adobe.com!asente
- From: asente@adobe.com
- Newsgroups: comp.sources.x
- Subject: v10i042: Examples from New Xt Book, Part02/05
- Message-ID: <144422@sun.Eng.Sun.COM>
- Date: 1 Nov 90 05:52:21 GMT
- References: <csx-10i041:xt-examples@uunet.UU.NET>
- Sender: news@sun.Eng.Sun.COM
- Lines: 1167
- Approved: argv@sun.com
-
- Submitted-by: asente@adobe.com
- Posting-number: Volume 10, Issue 42
- Archive-name: xt-examples/part02
-
- #! /bin/sh
- # This is a shell archive, meaning:
- # 1. Remove everything above the #! /bin/sh line.
- # 2. Save the resulting text in a file.
- # 3. Execute the file with /bin/sh (not csh) to create the files:
- # fragments
- # This archive created: Wed Oct 24 14:19:37 1990
- export PATH; PATH=/bin:$PATH
- if test ! -d 'fragments'
- then
- echo shar: creating directory "'fragments'"
- mkdir 'fragments'
- fi
- echo shar: entering directory "'fragments'"
- cd 'fragments'
- echo shar: extracting "'complexboxgeometrymanager.c'" '(2832 characters)'
- if test -f 'complexboxgeometrymanager.c'
- then
- echo shar: will not over-write existing file "'complexboxgeometrymanager.c'"
- else
- sed 's/^ X//' << \SHAR_EOF > 'complexboxgeometrymanager.c'
- X/***********************************************************
- XCopyright 1990 by Digital Equipment Corporation, Maynard, Massachusetts.
- X
- X All Rights Reserved
- X
- XPermission to use, copy, modify, and distribute these examples for any
- Xpurpose and without fee is hereby granted, provided that the above
- Xcopyright notice appear in all copies and that both that copyright
- Xnotice and this permission notice appear in supporting documentation,
- Xand that the name of Digital not be used in advertising or publicity
- Xpertaining to distribution of the software without specific, written
- Xprior permission.
- X
- XDIGITAL AND THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- XSOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- XFITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT
- XOR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- XOF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- XOR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
- XOR PERFORMANCE OF THIS SOFTWARE.
- X
- X******************************************************************/
- X
- Xstatic XtGeometryResult GeometryManager(w, desired, allowed)
- X Widget w;
- X XtWidgetGeometry *desired, *allowed;
- X{
- X BoxWidget box = (BoxWidget) XtParent(w);
- X XtWidgetGeometry request;
- X XtGeometryResult result;
- X Dimension save_width, save_height, save_border_width;
- X Position save_x, save_y;
- X
- X#define Wants(flag) (desired->request_mode & flag)
- X
- X save_width = w->core.width;
- X save_height = w->core.height;
- X save_border_width = w->core.border_width;
- X save_x = w->core.x;
- X save_y = w->core.y;
- X
- X if (Wants(CWWidth)) w->core.width = desired->width;
- X if (Wants(CWHeight)) w->core.height = desired->height;
- X if (Wants(CWX)) w->core.x = desired->x;
- X if (Wants(CWY)) w->core.y = desired->y;
- X if (Wants(CWBorderWidth)) {
- X w->core.border_width = desired->border_width;
- X }
- X
- X CalculateNewSize(box, &request.width, &request.height);
- X
- X if (request.width == box->core.width &&
- X request.height == box->core.height) {
- X if (Wants(XtCWQueryOnly)) {
- X w->core.width = save_width;
- X w->core.height = save_height;
- X w->core.border_width = save_border_width;
- X w->core.x = save_x;
- X w->core.y = save_y;
- X }
- X return XtGeometryYes;
- X }
- X
- X request.request_mode = CWWidth | CWHeight;
- X if (Wants(XtCWQueryOnly)) request.request_mode |= XtCWQueryOnly;
- X
- X result = XtMakeGeometryRequest((Widget) box, &request,
- X (XtGeometryRequest *) NULL);
- X if (result == XtGeometryAlmost) result = XtGeometryNo;
- X if (result == XtGeometryNo || Wants(XtCWQueryOnly)) {
- X w->core.width = save_width;
- X w->core.height = save_height;
- X w->core.border_width = save_border_width;
- X w->core.x = save_x;
- X w->core.y = save_y;
- X }
- X return result;
- X
- X#undef Wants
- X}
- SHAR_EOF
- if test 2832 -ne "`wc -c < 'complexboxgeometrymanager.c'`"
- then
- echo shar: error transmitting "'complexboxgeometrymanager.c'" '(should have been 2832 characters)'
- fi
- fi # end of overwriting check
- echo shar: extracting "'Vendor.h'" '(1451 characters)'
- if test -f 'Vendor.h'
- then
- echo shar: will not over-write existing file "'Vendor.h'"
- else
- sed 's/^ X//' << \SHAR_EOF > 'Vendor.h'
- X/***********************************************************
- XCopyright 1990 by Digital Equipment Corporation, Maynard, Massachusetts.
- X
- X All Rights Reserved
- X
- XPermission to use, copy, modify, and distribute these examples for any
- Xpurpose and without fee is hereby granted, provided that the above
- Xcopyright notice appear in all copies and that both that copyright
- Xnotice and this permission notice appear in supporting documentation,
- Xand that the name of Digital not be used in advertising or publicity
- Xpertaining to distribution of the software without specific, written
- Xprior permission.
- X
- XDIGITAL AND THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- XSOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- XFITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT
- XOR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- XOF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- XOR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
- XOR PERFORMANCE OF THIS SOFTWARE.
- X
- X******************************************************************/
- X
- X#ifndef VENDOR_H
- X#define VENDOR_H
- X
- X#define XtNnoTitle "noTitle"
- X#define XtNtitleFont "titleFont"
- X
- X#define XtCNoTitle "NoTitle"
- X#define XtCTitleFont "TitleFont"
- X
- X/* Class record constants */
- X
- Xtypedef struct _VendorShellClassRec *VendorShellWidgetClass;
- X
- Xextern WidgetClass vendorShellWidgetClass;
- X
- X#endif /* VENDOR_H */
- SHAR_EOF
- if test 1451 -ne "`wc -c < 'Vendor.h'`"
- then
- echo shar: error transmitting "'Vendor.h'" '(should have been 1451 characters)'
- fi
- fi # end of overwriting check
- echo shar: extracting "'VendorP.h'" '(1925 characters)'
- if test -f 'VendorP.h'
- then
- echo shar: will not over-write existing file "'VendorP.h'"
- else
- sed 's/^ X//' << \SHAR_EOF > 'VendorP.h'
- X/***********************************************************
- XCopyright 1990 by Digital Equipment Corporation, Maynard, Massachusetts.
- X
- X All Rights Reserved
- X
- XPermission to use, copy, modify, and distribute these examples for any
- Xpurpose and without fee is hereby granted, provided that the above
- Xcopyright notice appear in all copies and that both that copyright
- Xnotice and this permission notice appear in supporting documentation,
- Xand that the name of Digital not be used in advertising or publicity
- Xpertaining to distribution of the software without specific, written
- Xprior permission.
- X
- XDIGITAL AND THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- XSOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- XFITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT
- XOR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- XOF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- XOR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
- XOR PERFORMANCE OF THIS SOFTWARE.
- X
- X******************************************************************/
- X
- X#ifndef VENDORP_H
- X#define VENDORP_H
- X
- X/* New fields for the VendorShell widget class record */
- X
- Xtypedef struct {
- X XtPointer extension;
- X} VendorShellClassPart;
- X
- Xtypedef struct _VendorShellClassRec {
- X CoreClassPart core_class;
- X CompositeClassPart composite_class;
- X ShellClassPart shell_class;
- X WMShellClassPart wm_shell_class;
- X VendorShellClassPart vendor_shell_class;
- X} VendorShellClassRec;
- X
- Xextern VendorShellClassRec vendorShellClassRec;
- X
- X/* New fields for the vendor shell widget. */
- X
- Xtypedef struct {
- X Boolean no_title;
- X Font title_font;
- X} VendorShellPart;
- X
- Xtypedef struct {
- X CorePart core;
- X CompositePart composite;
- X ShellPart shell;
- X WMShellPart wm;
- X VendorShellPart vendor;
- X} VendorShellRec, *VendorShellWidget;
- X
- X#endif /* VENDORP_H */
- SHAR_EOF
- if test 1925 -ne "`wc -c < 'VendorP.h'`"
- then
- echo shar: error transmitting "'VendorP.h'" '(should have been 1925 characters)'
- fi
- fi # end of overwriting check
- echo shar: extracting "'appgoodbye.c'" '(2135 characters)'
- if test -f 'appgoodbye.c'
- then
- echo shar: will not over-write existing file "'appgoodbye.c'"
- else
- sed 's/^ X//' << \SHAR_EOF > 'appgoodbye.c'
- X/***********************************************************
- XCopyright 1990 by Digital Equipment Corporation, Maynard, Massachusetts.
- X
- X All Rights Reserved
- X
- XPermission to use, copy, modify, and distribute these examples for any
- Xpurpose and without fee is hereby granted, provided that the above
- Xcopyright notice appear in all copies and that both that copyright
- Xnotice and this permission notice appear in supporting documentation,
- Xand that the name of Digital not be used in advertising or publicity
- Xpertaining to distribution of the software without specific, written
- Xprior permission.
- X
- XDIGITAL AND THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- XSOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- XFITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT
- XOR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- XOF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- XOR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
- XOR PERFORMANCE OF THIS SOFTWARE.
- X
- X******************************************************************/
- X
- Xint main(argc, argv)
- X unsigned int argc;
- X char **argv;
- X{
- X Widget toplevel, label, button, box;
- X XtAppContext app;
- X Display *dpy;
- X Arg args[2];
- X int n;
- X unsigned_int saved_argc;
- X char **saved_argv;
- X
- X XtToolkitInitialize(); /* Initialize the toolkit */
- X
- X app = XtCreateApplicationContext(); /* Create an app context */
- X
- X /* Copy argc and argv */
- X saved_argc = argc;
- X saved_argv = XtMalloc(argc * sizeof(char *));
- X bcopy(argv, saved_argv, argc * sizeof(char *));
- X
- X /* Open the default display */
- X dpy = XtOpenDisplay(app, NULL, NULL, "Goodbye",
- X NULL, 0, &argc, argv);
- X
- X if (dpy == NULL) {
- X fprintf(stderr, "Couldn't open display connection\n");
- X exit(1);
- X }
- X
- X /* Create a shell */
- X n = 0;
- X XtSetArg(args[n], XtNargc, saved_argc); n++;
- X XtSetArg(args[n], XtNargv, saved_argv); n++;
- X
- X toplevel = XtAppCreateShell(NULL, "Goodbye",
- X applicationShellWidgetClass, dpy, args, n);
- X
- X /* The rest of the code is identical */
- X}
- SHAR_EOF
- if test 2135 -ne "`wc -c < 'appgoodbye.c'`"
- then
- echo shar: error transmitting "'appgoodbye.c'" '(should have been 2135 characters)'
- fi
- fi # end of overwriting check
- echo shar: extracting "'extension.c'" '(1957 characters)'
- if test -f 'extension.c'
- then
- echo shar: will not over-write existing file "'extension.c'"
- else
- sed 's/^ X//' << \SHAR_EOF > 'extension.c'
- X/***********************************************************
- XCopyright 1990 by Digital Equipment Corporation, Maynard, Massachusetts.
- X
- X All Rights Reserved
- X
- XPermission to use, copy, modify, and distribute these examples for any
- Xpurpose and without fee is hereby granted, provided that the above
- Xcopyright notice appear in all copies and that both that copyright
- Xnotice and this permission notice appear in supporting documentation,
- Xand that the name of Digital not be used in advertising or publicity
- Xpertaining to distribution of the software without specific, written
- Xprior permission.
- X
- XDIGITAL AND THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- XSOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- XFITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT
- XOR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- XOF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- XOR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
- XOR PERFORMANCE OF THIS SOFTWARE.
- X
- X******************************************************************/
- X
- Xvoid MyDefineQueryMinimumSize(widget_class, proc)
- X WidgetClass widget_class;
- X MinimumSizeProc proc;
- X{
- X static Quark myWidgetSet = NULLQUARK;
- X MyCoreClassExtension extension;
- X
- X if (myWidgetSet == NULLQUARK) {
- X myWidgetSet = XrmStringToQuark("MY_WIDGET_SET");
- X }
- X
- X for (extension = widget_class->core_class.extension;
- X extension != NULL && extension->record_type != myWidgetSet;
- X extension = extension->next_extension) {}
- X
- X if (extension == NULL) {
- X extension = XtNew(MyCoreClassExtensionRec);
- X extension->next_extension = widget_class->core_class.extension;
- X widget_class->core_class.extension = extension;
- X extension->record_type = myWidgetSet;
- X extension->version = @i[something];
- X extension->record_size = sizeof(MyCoreClassExtensionRec);
- X }
- X
- X extension->query_minimum_size = proc;
- X}
- SHAR_EOF
- if test 1957 -ne "`wc -c < 'extension.c'`"
- then
- echo shar: error transmitting "'extension.c'" '(should have been 1957 characters)'
- fi
- fi # end of overwriting check
- echo shar: extracting "'fakeexample.c'" '(2304 characters)'
- if test -f 'fakeexample.c'
- then
- echo shar: will not over-write existing file "'fakeexample.c'"
- else
- sed 's/^ X//' << \SHAR_EOF > 'fakeexample.c'
- X/***********************************************************
- XCopyright 1990 by Digital Equipment Corporation, Maynard, Massachusetts.
- X
- X All Rights Reserved
- X
- XPermission to use, copy, modify, and distribute these examples for any
- Xpurpose and without fee is hereby granted, provided that the above
- Xcopyright notice appear in all copies and that both that copyright
- Xnotice and this permission notice appear in supporting documentation,
- Xand that the name of Digital not be used in advertising or publicity
- Xpertaining to distribution of the software without specific, written
- Xprior permission.
- X
- XDIGITAL AND THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- XSOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- XFITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT
- XOR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- XOF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- XOR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
- XOR PERFORMANCE OF THIS SOFTWARE.
- X
- X******************************************************************/
- X
- X#include <X11/Intrinsic.h>
- X#include <X11/StringDefs.h>
- X
- Xvoid DrawContents(widget, event, params, num_params)
- X Widget widget;
- X XEvent *event;
- X String *params; /* Unused */
- X Cardinal *num_params; /* Unused */
- X{
- X Window window = XtWindow(widget);
- X Display display = XtDisplay(widget);
- X
- X if (event->type != Expose) return;
- X /* Draw in the window... */
- X}
- X
- Xint main(argc, argv)
- X unsigned int argc;
- X char **argv;
- X{
- X Widget toplevel, panel;
- X Arg args[25];
- X int n;
- X XtAppContext app;
- X static XtActionsRec actions[] = {{"refresh", DrawContents}};
- X static char translations[] = "<Expose> : refresh()";
- X
- X toplevel = XtAppInitialize(&app, "Draw",
- X (XrmOptionDescList) NULL, 0, &argc, argv,
- X (String *) NULL, (ArgList) NULL, 0);
- X
- X XtAppAddActions(app, actions, XtNumber(actions));
- X
- X n = 0;
- X XtSetArg(args[n], XtNwidth, 100); n++;
- X XtSetArg(args[n], XtNheight, 100); n++;
- X XtSetArg(args[n], XtNtranslations,
- X XtParseTranslationTable(translations)); n++;
- X panel = XtCreateManagedWidget("panel", widgetClass, toplevel,
- X args, n);
- X
- X XtRealizeWidget(toplevel);
- X XtAppMainLoop(app);
- X}
- SHAR_EOF
- if test 2304 -ne "`wc -c < 'fakeexample.c'`"
- then
- echo shar: error transmitting "'fakeexample.c'" '(should have been 2304 characters)'
- fi
- fi # end of overwriting check
- echo shar: extracting "'fetchatom.c'" '(1446 characters)'
- if test -f 'fetchatom.c'
- then
- echo shar: will not over-write existing file "'fetchatom.c'"
- else
- sed 's/^ X//' << \SHAR_EOF > 'fetchatom.c'
- X/***********************************************************
- XCopyright 1990 by Digital Equipment Corporation, Maynard, Massachusetts.
- X
- X All Rights Reserved
- X
- XPermission to use, copy, modify, and distribute these examples for any
- Xpurpose and without fee is hereby granted, provided that the above
- Xcopyright notice appear in all copies and that both that copyright
- Xnotice and this permission notice appear in supporting documentation,
- Xand that the name of Digital not be used in advertising or publicity
- Xpertaining to distribution of the software without specific, written
- Xprior permission.
- X
- XDIGITAL AND THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- XSOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- XFITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT
- XOR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- XOF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- XOR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
- XOR PERFORMANCE OF THIS SOFTWARE.
- X
- X******************************************************************/
- X
- Xstatic Atom FetchAtom(w, name)
- X Widget w;
- X String name;
- X{
- X Atom a;
- X XrmValue source, dest;
- X
- X source.size = strlen(name)+1;
- X source.addr = name;
- X dest.size = sizeof(Atom);
- X dest.addr = (caddr_t) &a;
- X
- X (void) XtConvertAndStore(w, XtRString, &source, XtRAtom, &dest);
- X return a;
- X}
- X
- SHAR_EOF
- if test 1446 -ne "`wc -c < 'fetchatom.c'`"
- then
- echo shar: error transmitting "'fetchatom.c'" '(should have been 1446 characters)'
- fi
- fi # end of overwriting check
- echo shar: extracting "'keymappingexample.c'" '(1893 characters)'
- if test -f 'keymappingexample.c'
- then
- echo shar: will not over-write existing file "'keymappingexample.c'"
- else
- sed 's/^ X//' << \SHAR_EOF > 'keymappingexample.c'
- X/***********************************************************
- XCopyright 1990 by Digital Equipment Corporation, Maynard, Massachusetts.
- X
- X All Rights Reserved
- X
- XPermission to use, copy, modify, and distribute these examples for any
- Xpurpose and without fee is hereby granted, provided that the above
- Xcopyright notice appear in all copies and that both that copyright
- Xnotice and this permission notice appear in supporting documentation,
- Xand that the name of Digital not be used in advertising or publicity
- Xpertaining to distribution of the software without specific, written
- Xprior permission.
- X
- XDIGITAL AND THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- XSOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- XFITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT
- XOR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- XOF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- XOR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
- XOR PERFORMANCE OF THIS SOFTWARE.
- X
- X******************************************************************/
- X
- XKeySym k;
- Xchar ch;
- X
- X/* Don't care about the modifiers, so pass NULL */
- Xk = XtGetActionKeysym(event, NULL);
- X
- Xif (k == NoSymbol) {
- X /* Not a keyboard event or no keysym for the keycode in the
- X event. Do whatever is appropriate. */
- X} else {
- X /* Compensate for servers that call a minus a hyphen */
- X if (k == XK_hyphen) k = XK_minus;
- X
- X if (k & 0xFF00 != 0) {
- X /* Not a keysym for an ISO Latin-1 character. Do whatever
- X is appropriate. If restricting to ASCII, mask with
- X 0xFF80 instead. */
- X } else {
- X /* ISO Latin-1 keysyms are the same as the character */
- X ch = (char) k;
- X
- X /* If control is set, mask off high bits */
- X if (event->xkey.modifiers & ControlMask) ch &= 0x1F;
- X }
- X}
- X
- X/* Do whatever is appropriate with the character */
- X
- SHAR_EOF
- if test 1893 -ne "`wc -c < 'keymappingexample.c'`"
- then
- echo shar: error transmitting "'keymappingexample.c'" '(should have been 1893 characters)'
- fi
- fi # end of overwriting check
- echo shar: extracting "'setwmprotocol.c'" '(1932 characters)'
- if test -f 'setwmprotocol.c'
- then
- echo shar: will not over-write existing file "'setwmprotocol.c'"
- else
- sed 's/^ X//' << \SHAR_EOF > 'setwmprotocol.c'
- X/***********************************************************
- XCopyright 1990 by Digital Equipment Corporation, Maynard, Massachusetts.
- X
- X All Rights Reserved
- X
- XPermission to use, copy, modify, and distribute these examples for any
- Xpurpose and without fee is hereby granted, provided that the above
- Xcopyright notice appear in all copies and that both that copyright
- Xnotice and this permission notice appear in supporting documentation,
- Xand that the name of Digital not be used in advertising or publicity
- Xpertaining to distribution of the software without specific, written
- Xprior permission.
- X
- XDIGITAL AND THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- XSOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- XFITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT
- XOR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- XOF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- XOR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
- XOR PERFORMANCE OF THIS SOFTWARE.
- X
- X******************************************************************/
- X
- X/* Make these global, we'll need them later. If this is a multi-
- X display application, these must be kept for each display. */
- XAtom wm_take_focus, wm_save_yourself;
- X
- Xstatic Atom FetchAtom(w, name)
- X Widget w;
- X String name;
- X{
- X Atom a;
- X XrmValue source, dest;
- X
- X source.size = strlen(name)+1;
- X source.addr = name;
- X dest.size = sizeof(Atom);
- X dest.addr = &a;
- X
- X (void) XtConvertAndStore(w, XtRString, &source, XtRAtom, &dest);
- X return a;
- X}
- X
- X/* Time to set the protocols */
- XAtom protocolList[2];
- X
- Xwm_take_focus = FetchAtom(shell, "WM_TAKE_FOCUS");
- Xwm_save_yourself = FetchAtom(shell, "WM_SAVE_YOURSELF");
- XprotocolList[0] = wm_take_focus;
- XprotocolList[1] = wm_save_yourself;
- X
- X(void) XSetWMProtocols(XtDisplay(shell), XtWindow(shell),
- X protocolList, XtNumber(protocolList));
- SHAR_EOF
- if test 1932 -ne "`wc -c < 'setwmprotocol.c'`"
- then
- echo shar: error transmitting "'setwmprotocol.c'" '(should have been 1932 characters)'
- fi
- fi # end of overwriting check
- echo shar: extracting "'subresources.c'" '(1483 characters)'
- if test -f 'subresources.c'
- then
- echo shar: will not over-write existing file "'subresources.c'"
- else
- sed 's/^ X//' << \SHAR_EOF > 'subresources.c'
- X/***********************************************************
- XCopyright 1990 by Digital Equipment Corporation, Maynard, Massachusetts.
- X
- X All Rights Reserved
- X
- XPermission to use, copy, modify, and distribute these examples for any
- Xpurpose and without fee is hereby granted, provided that the above
- Xcopyright notice appear in all copies and that both that copyright
- Xnotice and this permission notice appear in supporting documentation,
- Xand that the name of Digital not be used in advertising or publicity
- Xpertaining to distribution of the software without specific, written
- Xprior permission.
- X
- XDIGITAL AND THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- XSOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- XFITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT
- XOR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- XOF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- XOR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
- XOR PERFORMANCE OF THIS SOFTWARE.
- X
- X******************************************************************/
- X
- Xtypedef struct {
- X int width_mm;
- X int height_mm;
- X} mmDimensions;
- X
- Xstatic XtResource subresources[] = {
- X {XtNwidthMM, XtCWidthMM, XtRInt, sizeof(int),
- X XtOffsetOf(mmDimensions, width_mm),
- X XtRImmediate, (XtPointer) -1},
- X {XtNheightMM, XtCHeightMM, XtRInt, sizeof(int),
- X XtOffsetOf(mmDimensions, height_mm),
- X XtRImmediate, (XtPointer) -1}
- X};
- SHAR_EOF
- if test 1483 -ne "`wc -c < 'subresources.c'`"
- then
- echo shar: error transmitting "'subresources.c'" '(should have been 1483 characters)'
- fi
- fi # end of overwriting check
- echo shar: extracting "'subresourcesgetvalues.c'" '(1448 characters)'
- if test -f 'subresourcesgetvalues.c'
- then
- echo shar: will not over-write existing file "'subresourcesgetvalues.c'"
- else
- sed 's/^ X//' << \SHAR_EOF > 'subresourcesgetvalues.c'
- X/***********************************************************
- XCopyright 1990 by Digital Equipment Corporation, Maynard, Massachusetts.
- X
- X All Rights Reserved
- X
- XPermission to use, copy, modify, and distribute these examples for any
- Xpurpose and without fee is hereby granted, provided that the above
- Xcopyright notice appear in all copies and that both that copyright
- Xnotice and this permission notice appear in supporting documentation,
- Xand that the name of Digital not be used in advertising or publicity
- Xpertaining to distribution of the software without specific, written
- Xprior permission.
- X
- XDIGITAL AND THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- XSOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- XFITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT
- XOR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- XOF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- XOR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
- XOR PERFORMANCE OF THIS SOFTWARE.
- X
- X******************************************************************/
- X
- X{
- X mmDimensions dim;
- X
- X dim.width_mm = w->core.width * WidthMMOfScreen(XtScreen(w)) /
- X WidthOfScreen(XtScreen(w));
- X dim.height_mm = w->core.height * HeightMMOfScreen(XtScreen(w)) /
- X HeightOfScreen(XtScreen(w));
- X
- X XtGetSubvalues(&dim, subresources, XtNumber(subresources),
- X args, num_args);
- X}
- X
- SHAR_EOF
- if test 1448 -ne "`wc -c < 'subresourcesgetvalues.c'`"
- then
- echo shar: error transmitting "'subresourcesgetvalues.c'" '(should have been 1448 characters)'
- fi
- fi # end of overwriting check
- echo shar: extracting "'subresourcesinit.c'" '(1584 characters)'
- if test -f 'subresourcesinit.c'
- then
- echo shar: will not over-write existing file "'subresourcesinit.c'"
- else
- sed 's/^ X//' << \SHAR_EOF > 'subresourcesinit.c'
- X/***********************************************************
- XCopyright 1990 by Digital Equipment Corporation, Maynard, Massachusetts.
- X
- X All Rights Reserved
- X
- XPermission to use, copy, modify, and distribute these examples for any
- Xpurpose and without fee is hereby granted, provided that the above
- Xcopyright notice appear in all copies and that both that copyright
- Xnotice and this permission notice appear in supporting documentation,
- Xand that the name of Digital not be used in advertising or publicity
- Xpertaining to distribution of the software without specific, written
- Xprior permission.
- X
- XDIGITAL AND THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- XSOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- XFITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT
- XOR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- XOF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- XOR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
- XOR PERFORMANCE OF THIS SOFTWARE.
- X
- X******************************************************************/
- X
- X{
- X mmDimensions dim;
- X
- X XtGetSubresources(new, &dim, (String) NULL, (String) NULL,
- X subresources, XtNumber(subresources), args, num_args);
- X
- X if (dim.width_mm != -1) {
- X new->core.width = dim.width_mm * WidthOfScreen(XtScreen(new)) /
- X WidthMMOfScreen(XtScreen(new));
- X }
- X if (dim.height_mm != -1) {
- X new->core.height = dim.height_mm *
- X HeightOfScreen(XtScreen(new)) /
- X HeightMMOfScreen(XtScreen(new));
- X }
- X}
- SHAR_EOF
- if test 1584 -ne "`wc -c < 'subresourcesinit.c'`"
- then
- echo shar: error transmitting "'subresourcesinit.c'" '(should have been 1584 characters)'
- fi
- fi # end of overwriting check
- echo shar: extracting "'subresourcessetvalues.c'" '(1568 characters)'
- if test -f 'subresourcessetvalues.c'
- then
- echo shar: will not over-write existing file "'subresourcessetvalues.c'"
- else
- sed 's/^ X//' << \SHAR_EOF > 'subresourcessetvalues.c'
- X/***********************************************************
- XCopyright 1990 by Digital Equipment Corporation, Maynard, Massachusetts.
- X
- X All Rights Reserved
- X
- XPermission to use, copy, modify, and distribute these examples for any
- Xpurpose and without fee is hereby granted, provided that the above
- Xcopyright notice appear in all copies and that both that copyright
- Xnotice and this permission notice appear in supporting documentation,
- Xand that the name of Digital not be used in advertising or publicity
- Xpertaining to distribution of the software without specific, written
- Xprior permission.
- X
- XDIGITAL AND THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- XSOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- XFITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT
- XOR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- XOF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- XOR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
- XOR PERFORMANCE OF THIS SOFTWARE.
- X
- X******************************************************************/
- X
- X{
- X static mmDimensions dim = {-1, -1};
- X
- X XtSetSubvalues(&dim, subresources, XtNumber(subresources),
- X args, num_args);
- X
- X if (dim.width_mm != -1) {
- X new->core.width = dim.width_mm * WidthOfScreen(XtScreen(new)) /
- X WidthMMOfScreen(XtScreen(new));
- X }
- X if (dim.height_mm != -1) {
- X new->core.height = dim.height_mm *
- X HeightOfScreen(XtScreen(new)) /
- X HeightMMOfScreen(XtScreen(new));
- X }
- X}
- SHAR_EOF
- if test 1568 -ne "`wc -c < 'subresourcessetvalues.c'`"
- then
- echo shar: error transmitting "'subresourcessetvalues.c'" '(should have been 1568 characters)'
- fi
- fi # end of overwriting check
- echo shar: extracting "'vendorinitialize.c'" '(1896 characters)'
- if test -f 'vendorinitialize.c'
- then
- echo shar: will not over-write existing file "'vendorinitialize.c'"
- else
- sed 's/^ X//' << \SHAR_EOF > 'vendorinitialize.c'
- X/***********************************************************
- XCopyright 1990 by Digital Equipment Corporation, Maynard, Massachusetts.
- X
- X All Rights Reserved
- X
- XPermission to use, copy, modify, and distribute these examples for any
- Xpurpose and without fee is hereby granted, provided that the above
- Xcopyright notice appear in all copies and that both that copyright
- Xnotice and this permission notice appear in supporting documentation,
- Xand that the name of Digital not be used in advertising or publicity
- Xpertaining to distribution of the software without specific, written
- Xprior permission.
- X
- XDIGITAL AND THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- XSOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- XFITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT
- XOR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- XOF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- XOR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
- XOR PERFORMANCE OF THIS SOFTWARE.
- X
- X******************************************************************/
- X
- Xstatic void VendorShellInitialize(req, new, args, num_args)
- X Widget req, new;
- X ArgList args;
- X Cardinal *num_args;
- X{
- X VendorShellWidget v = (VendorShellWidget) new;
- X Atom my_wm_title_font, actual_type;
- X int actual_format;
- X unsigned long nitems, bytes_after;
- X unsigned char *data;
- X
- X my_wm_title_font = FetchAtom(new, "MY_WM_TITLE_FONT");
- X
- X if (XGetWindowProperty(XtDisplay(v),
- X RootWindowOfScreen(XtScreen(v)),
- X my_wm_title_font, 0L, 1L, False, my_wm_title_font,
- X &actual_type, &actual_format, &nitems,
- X &bytes_after, &data) == Success &&
- X actual_type == my_wm_title_font &&
- X actual_format == 32) {
- X v->vendor.title_font = (Font) *data;
- X } else v->vendor.title_font = None;
- X
- X if (data != NULL) XFree((char *) data);
- X}
- SHAR_EOF
- if test 1896 -ne "`wc -c < 'vendorinitialize.c'`"
- then
- echo shar: error transmitting "'vendorinitialize.c'" '(should have been 1896 characters)'
- fi
- fi # end of overwriting check
- echo shar: extracting "'vendorrealize.c'" '(1606 characters)'
- if test -f 'vendorrealize.c'
- then
- echo shar: will not over-write existing file "'vendorrealize.c'"
- else
- sed 's/^ X//' << \SHAR_EOF > 'vendorrealize.c'
- X/***********************************************************
- XCopyright 1990 by Digital Equipment Corporation, Maynard, Massachusetts.
- X
- X All Rights Reserved
- X
- XPermission to use, copy, modify, and distribute these examples for any
- Xpurpose and without fee is hereby granted, provided that the above
- Xcopyright notice appear in all copies and that both that copyright
- Xnotice and this permission notice appear in supporting documentation,
- Xand that the name of Digital not be used in advertising or publicity
- Xpertaining to distribution of the software without specific, written
- Xprior permission.
- X
- XDIGITAL AND THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- XSOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- XFITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT
- XOR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- XOF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- XOR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
- XOR PERFORMANCE OF THIS SOFTWARE.
- X
- X******************************************************************/
- X
- Xstatic void VendorShellRealize(w, mask, attr)
- X Widget w;
- X XtValueMask *mask;
- X XSetWindowAttributes *attr;
- X{
- X VendorShellWidget v = (VendorShellWidget) w;
- X Atom my_wm_no_title = FetchAtom(w, "MY_WM_NO_TITLE");
- X
- X /* Make my superclass do all the dirty work */
- X
- X (*wmShellWidgetClass->core_class.realize) (w, mask, attr);
- X
- X if (v->vendor.no_title) {
- X XChangeProperty(XtDisplay(w), XtWindow(w),
- X my_wm_no_title, my_wm_no_title,
- X 8, PropModeReplace, NULL, 0);
- X }
- X}
- SHAR_EOF
- if test 1606 -ne "`wc -c < 'vendorrealize.c'`"
- then
- echo shar: error transmitting "'vendorrealize.c'" '(should have been 1606 characters)'
- fi
- fi # end of overwriting check
- echo shar: extracting "'vendorresources.c'" '(1474 characters)'
- if test -f 'vendorresources.c'
- then
- echo shar: will not over-write existing file "'vendorresources.c'"
- else
- sed 's/^ X//' << \SHAR_EOF > 'vendorresources.c'
- X/***********************************************************
- XCopyright 1990 by Digital Equipment Corporation, Maynard, Massachusetts.
- X
- X All Rights Reserved
- X
- XPermission to use, copy, modify, and distribute these examples for any
- Xpurpose and without fee is hereby granted, provided that the above
- Xcopyright notice appear in all copies and that both that copyright
- Xnotice and this permission notice appear in supporting documentation,
- Xand that the name of Digital not be used in advertising or publicity
- Xpertaining to distribution of the software without specific, written
- Xprior permission.
- X
- XDIGITAL AND THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- XSOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- XFITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT
- XOR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- XOF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- XOR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
- XOR PERFORMANCE OF THIS SOFTWARE.
- X
- X******************************************************************/
- X
- X#define Offset(field) XtOffsetOf(VendorShellWidgetRec, vendor.field)
- X
- Xstatic XtResource resources[] = {
- X {XtNnoTitle, XtCNoTitle, XtRBoolean, sizeof(Boolean),
- X Offset(no_title), XtRImmediate, (XtPointer) FALSE},
- X {XtNtitleFont, XtCTitleFont, XtRFont, sizeof(Font),
- X Offset(title_font), XtRImmediate, (XtPointer) None}
- X};
- X
- X#undef Offset
- SHAR_EOF
- if test 1474 -ne "`wc -c < 'vendorresources.c'`"
- then
- echo shar: error transmitting "'vendorresources.c'" '(should have been 1474 characters)'
- fi
- fi # end of overwriting check
- echo shar: extracting "'vendorsetvalues.c'" '(1856 characters)'
- if test -f 'vendorsetvalues.c'
- then
- echo shar: will not over-write existing file "'vendorsetvalues.c'"
- else
- sed 's/^ X//' << \SHAR_EOF > 'vendorsetvalues.c'
- X/***********************************************************
- XCopyright 1990 by Digital Equipment Corporation, Maynard, Massachusetts.
- X
- X All Rights Reserved
- X
- XPermission to use, copy, modify, and distribute these examples for any
- Xpurpose and without fee is hereby granted, provided that the above
- Xcopyright notice appear in all copies and that both that copyright
- Xnotice and this permission notice appear in supporting documentation,
- Xand that the name of Digital not be used in advertising or publicity
- Xpertaining to distribution of the software without specific, written
- Xprior permission.
- X
- XDIGITAL AND THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- XSOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- XFITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT
- XOR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- XOF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- XOR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
- XOR PERFORMANCE OF THIS SOFTWARE.
- X
- X******************************************************************/
- X
- Xstatic Boolean VendorShellSetValues(old, ref, new, args, num_args)
- X Widget old, req, new;
- X ArgList args;
- X Cardinal *num_args;
- X{
- X VendorShellWidget ov = (VendorShellWidget) old;
- X VendorShellWidget nv = (VendorShellWidget) new;
- X Atom my_wm_no_title;
- X
- X if (XtIsRealized(new)) {
- X if (ov->vendor.no_title != nv->vendor.no_title) {
- X my_wm_no_title = FetchAtom(new, "MY_WM_NO_TITLE");
- X
- X if (nv->vendor.no_title) {
- X XChangeProperty(XtDisplay(new), XtWindow(new),
- X my_wm_no_title, my_wm_no_title,
- X 8, PropModeReplace, NULL, 0);
- X } else {
- X XDeleteProperty(XtDisplay(new), XtWindow(new),
- X my_wm_no_title);
- X }
- X }
- X }
- X
- X nv->vendor.title_font = ov->vendor.title_font;
- X return FALSE;
- X}
- SHAR_EOF
- if test 1856 -ne "`wc -c < 'vendorsetvalues.c'`"
- then
- echo shar: error transmitting "'vendorsetvalues.c'" '(should have been 1856 characters)'
- fi
- fi # end of overwriting check
- echo shar: extracting "'wmprotocolaction.c'" '(1926 characters)'
- if test -f 'wmprotocolaction.c'
- then
- echo shar: will not over-write existing file "'wmprotocolaction.c'"
- else
- sed 's/^ X//' << \SHAR_EOF > 'wmprotocolaction.c'
- X/***********************************************************
- XCopyright 1990 by Digital Equipment Corporation, Maynard, Massachusetts.
- X
- X All Rights Reserved
- X
- XPermission to use, copy, modify, and distribute these examples for any
- Xpurpose and without fee is hereby granted, provided that the above
- Xcopyright notice appear in all copies and that both that copyright
- Xnotice and this permission notice appear in supporting documentation,
- Xand that the name of Digital not be used in advertising or publicity
- Xpertaining to distribution of the software without specific, written
- Xprior permission.
- X
- XDIGITAL AND THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- XSOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- XFITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT
- XOR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- XOF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- XOR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
- XOR PERFORMANCE OF THIS SOFTWARE.
- X
- X******************************************************************/
- X
- Xstatic void WMProtocolAction(w, event, params, num_params)
- X Widget w;
- X XEvent *event;
- X String *params; /* unused */
- X Cardinal *num_params; /* unused */
- X{
- X Atom protocol = (Atom) event->xclient.data.l[0];
- X
- X if (event->type != ClientMessage) return;
- X
- X /* Use atom values we got earlier */
- X if (protocol == wm_take_focus) {
- X Time t = (Time) event->xclient.data.l[1];
- X (void) XtCallAcceptFocus(mainWidget, &t);
- X } else if (protocol == wm_save_yourself) {
- X /* Save application state */
- X }
- X}
- X
- Xstatic char *shellTrans =
- X "<ClientMessage> WM_PROTOCOLS : WMProtocolAction()";
- Xstatic XtActionsRec actions[] = {
- X {"WMProtocolAction", WMProtocolAction}
- X};
- X
- XXtAppAddActions(app, actions, XtNumber(actions));
- XXtAugmentTranslations(shell, XtParseTranslationTable(shellTrans));
- SHAR_EOF
- if test 1926 -ne "`wc -c < 'wmprotocolaction.c'`"
- then
- echo shar: error transmitting "'wmprotocolaction.c'" '(should have been 1926 characters)'
- fi
- fi # end of overwriting check
- echo shar: extracting "'workproc.c'" '(1558 characters)'
- if test -f 'workproc.c'
- then
- echo shar: will not over-write existing file "'workproc.c'"
- else
- sed 's/^ X//' << \SHAR_EOF > 'workproc.c'
- X/***********************************************************
- XCopyright 1990 by Digital Equipment Corporation, Maynard, Massachusetts.
- X
- X All Rights Reserved
- X
- XPermission to use, copy, modify, and distribute these examples for any
- Xpurpose and without fee is hereby granted, provided that the above
- Xcopyright notice appear in all copies and that both that copyright
- Xnotice and this permission notice appear in supporting documentation,
- Xand that the name of Digital not be used in advertising or publicity
- Xpertaining to distribution of the software without specific, written
- Xprior permission.
- X
- XDIGITAL AND THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- XSOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- XFITNESS, IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT
- XOR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- XOF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- XOR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
- XOR PERFORMANCE OF THIS SOFTWARE.
- X
- X******************************************************************/
- X
- XBoolean CreatePopupChild(client_data)
- X XtPointer client_data;
- X{
- X Widget shell = (Widget) client_data;
- X Cardinal num_children;
- X XtCreatePopupChildProc create;
- X Arg args[2];
- X int n = 0;
- X
- X XtSetArg(args[n], XtNnumChildren, &num_children); n++;
- X XtSetArg(args[n], XtNcreatePopupChildProc, &create); n++;
- X
- X XtGetValues(shell, args, n);
- X
- X if (num_children == 0) (*create) (shell);
- X
- X return TRUE;
- X}
- SHAR_EOF
- if test 1558 -ne "`wc -c < 'workproc.c'`"
- then
- echo shar: error transmitting "'workproc.c'" '(should have been 1558 characters)'
- fi
- fi # end of overwriting check
- echo shar: done with directory "'fragments'"
- cd ..
- # End of shell archive
- exit 0
-
- dan
- ----------------------------------------------------
- O'Reilly && Associates argv@sun.com / argv@ora.com
- Opinions expressed reflect those of the author only.
-